package com.grass.appointment.model;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.androidx.p013lv.base.http.BaseRes;
import com.androidx.p013lv.base.http.HttpUtils;
import com.androidx.p013lv.base.http.UrlManager;
import com.androidx.p013lv.base.http.callback.HttpCallback;
import com.androidx.p013lv.base.interfaces.Key;
import com.grass.appointment.bean.CityResBean;

public class CitySelectModel extends ViewModel {
    private MutableLiveData<BaseRes<CityResBean>> cityResLiveData;

    public MutableLiveData<BaseRes<CityResBean>> data() {
        if (this.cityResLiveData == null) {
            this.cityResLiveData = new MutableLiveData<>();
        }
        return this.cityResLiveData;
    }

    public void getCityList() {
        HttpUtils.getInsatance().get(UrlManager.getInsatance().getCityInfo(), new HttpCallback<BaseRes<CityResBean>>(Key.CITY) {
            /* class com.grass.appointment.model.CitySelectModel.C28321 */

            public void onLvSuccess(BaseRes<CityResBean> baseRes) {
                CitySelectModel.this.cityResLiveData.setValue(baseRes);
            }
        });
    }

    public void cancelHttp() {
        HttpUtils.getInsatance().cancelTag(Key.CITY);
    }
}
